{literal}
<script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete the category. Continue?"))
document.location = "admin.php?page=links&action=delete&id=" + articleId;
}

function deletedown(photoid, albumid) {
if (confirm("This will remove the link from the category. Continue?"))
document.location = "admin.php?page=links&action=deletedown&did=" + photoid + "&id=" + albumid;
}

function confirmPublish(articleId, al)
{
    if (confirm("This will publish the link. Continue?")){/literal}
    document.location = "{$pagename}&action=publish&did=" + articleId + "&id=" + al;{literal}
}

function confirmunPublish(articleId, al)
{
    if (confirm("This will unpublish the link. Continue?")){/literal}
    document.location = "{$pagename}&action=unpublish&did=" + articleId + "&id=" + al;{literal}
}


//-->
</script>
{/literal}
{if $action != 'view' && $action != "addlink" && $action != "editlink" && $action != "edit" && $action != "add"}
{if $num_cats > 0}
<h2>Link Database Categories</h2>
<div align="left"><input type="button" class="button" value="Add Link Category" onclick="window.location='{$pagename}&amp;action=add'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
	  <tr>
		<th width="10%" class="smallhead">Action</th>
		<th width="15%" class="smallhead">Category</th>
	  </tr> 
	 {section name=catloop loop=$num_cats}
		 <tr>
			<td class="text"><a href="{$pagename}&amp;action=view&amp;id={$cats[catloop].id}"><img src="{$tempdir}admin/images/mod.gif" border="0" alt="View {$cats[catloop].name} items" title="View {$cats[catloop].name} items" /></a> - <a href="{$pagename}&amp;action=edit&amp;id={$cats[catloop].id}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$cats[catloop].name}" title="Edit {$cats[catloop].name}" /></a> - <a href="javascript:confirmDelete({$cats[catloop].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$cats[catloop].name}" title="Delete {$cats[catloop].name}" /></a></td>
			<td class="text">{$cats[catloop].name}</td>
	  </tr>
	  {/section}
	</table>
    {else}
<div align="center">No Link categories</div>
{/if}
<div align="left"><input type="button" class="button" value="Add Link Category" onclick="window.location='{$pagename}&amp;action=add'" /></div>
  {elseif $action == "view"}
  {if $numlinks > 0}
  <h2>Links in {$catinfo.name}</h2>
<div align="left"><input type="button" class="button" value="Add Link" onclick="window.location='{$pagename}&amp;action=adddown&amp;id={$catinfo.id}'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
	  <tr> 
	  <th colspan="4" class="bighead">Links for {$catinfo.name}</th>
	</tr>
	  <tr>
		<th width="10%" class="smallhead">Action</th>
		<th width="25%" class="smallhead">Name</th>
		<th width="35%" class="smallhead">Descripton</th>
        <th width="30%" class="smallhead">Link</th>
	  </tr> 
	 {section name=links loop=$numlinks}
		 <tr>
			<td class="text"><a href="{$pagename}&amp;action=editlink&amp;id={$catinfo.id}&amp;did={$links[links].id}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$links[links].name}" title="Edit {$links[links].name}" /></a> - <a href="javascript:deletedown({$links[links].id},{$catinfo.id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$links[links].name}" title="Delete {$links[links].name}" /></a></td>
			<td class="text">{$links[links].name}</td>
			<td class="text">{$links[links].desc}</td>
            <td class="text"><a href="http://{$links[links].url}">{$links[links].url}</a></td>
	  </tr>
	  {/section}
	</table>
    {else}
<div align="center">No Links in {$catinfo.name}</div>
{/if}
<div align="left"><input type="button" class="button" value="Add Link" onclick="window.location='{$pagename}&amp;action=addlink&amp;id={$catinfo.id}'" />&nbsp;
<input type="button" class="button" value="Back" onclick="window.location='{$pagename}'" /></div>
  {elseif $action=="addlink" || $action=="editlink"}
  <form action="{$editFormAction}" method="post"  name="form1">
    <p align="center">Name of link:<br />
      <input name="name" type="text" id="name" size="60" maxlength="50" value="{$links.name}" class="inputbox" />
      <br />
      Description:      <br />
      <textarea name="desc" cols="50" rows="5" id="desc" class="inputbox">{$links.desc}</textarea>      
      <br />
    URL<br />
    http://<input name="url" type="text" size="100" class="inputbox" value="{$links.url}"/>
    <br />
    <input type="submit" name="Submit" value="Submit" class="button" />
		<input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
    </p>
</form>
{elseif $action=="add" || $action == "edit"}
<form name="form2" method="post" action="">
<table width = "100%">
<tr><td class="text" align = "center" colspan="2">
    Category Name: <input name="catname" size="50" value="{$cat.name}"  class="inputbox"/>
    </td>
</tr>
  </table>
  <p align="left">
    <input type="submit" name="Submit" value="Submit" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
   </p>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-link" target="_blank">Help</a>
</div>
